Repository navigation
Add huawei scale 3 support - #1474
Conversation
…a96/openScale into add-huawei-scale-3-support
|
Thanks for your PR.
The range checks only mask part of it. The PR's own fixture yields visceral=4.2 — that's the seconds field (42) ÷ 10. Systematically: water passes on days 1–3 Do you have a capture where those four fields actually carry body composition? Otherwise I'd rather drop this part than write it into users' history.
Smaller: the gender flip (MALE→1/FEMALE→0) changes the scale-computed body composition for already-working devices — can you back it with a capture? userType = |
|
Thanks for the detailed review. You were right on all of those points.
For Scale 3 specifically, testing on the physical device showed that relying only on the history path did not persist the current weighing. I therefore scoped the realtime persistence fallback to Scale 3 only. It caches the latest valid realtime measurement and publishes at most once after measurement status reaches 0x00. The other Hagrid families are unchanged. The Scale 3 gender mapping is also now scoped only to Scale 3. I do have a Huawei Health BLE capture for this device showing a male profile encoded with gender byte 0x01. Other Hagrid families retain the previous male=0/female=1 mapping. I also removed the explicit userType=0 argument and cleaned up the stray formatting. I also re-tested the current Scale 3 flow on-device and confirmed that the current weighing is persisted correctly. |
|
Thanks! The Scale 3 specifics are cleanly gated on One change isn't gated: Could you make it tolerant so Scale 3 gains the timestamp and nothing else can break? // realtime: read it when present, but never reject the measurement over it
val timestamp = if (timestampPresent) readTimestamp(payload, 4) else null |
|
Tested the latest changes on a physical Huawei Scale 3 and everything is working correctly. Realtime timestamp parsing is now tolerant as requested: valid timestamps are kept, while invalid/non-timestamp values no longer reject the realtime measurement. History still requires a valid timestamp. I also verified the full Scale 3 flow on-device, including realtime updates and persistence of the final measurement. Thanks again for the detailed review. |
- Update test assertions to use Google Truth assertions instead of JUnit assertions - Map additional scale model names to the correct handler class - Add mappings for "HUAWEI Scale 3", "HUAWEI Scale 3 Pro", and "Hagrid-B29"
# Conflicts: # android_app/app/src/test/java/com/health/openscale/core/bluetooth/ScaleFactoryTest.kt
|
Thanks — the tolerant realtime timestamp is exactly what I was after, and the separate I've merged master and added: Truth assertions in |
Summary
Adds support for Huawei Scale 3 using Huawei's Hagrid/WSP BLE protocol.
The implementation includes:
Testing
Tested on a physical Huawei Scale 3 with openScale on Android.
Verified:
Implementation notes
Huawei authentication requires CAK, C1 and C2 to be configured manually in the device settings.
The implementation does not include Huawei Health key extraction, APK extraction, root, Frida, or other external key-retrieval mechanisms.
The realtime measurement request is sent before measurement-status polling, matching the behavior observed from the Huawei protocol.
Derived values such as BMR and lean body mass are left to openScale's existing derived-value system instead of being calculated inside the scale driver.
Scope
This PR is focused on Huawei Scale 3 / Hagrid WSP support and does not intentionally change unrelated UI or Bluetooth behavior.